package com.yyzw.activiti.modeler.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yyzw.activiti.modeler.dao.JobMapper;
import com.yyzw.activiti.modeler.model.DataGridRespVo;
import com.yyzw.activiti.modeler.model.JobVo;
import com.yyzw.activiti.modeler.model.SysRole;
import com.yyzw.activiti.modeler.service.JobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class JobServiceImpl implements JobService {

    @Autowired
    JobMapper jobMapper;
    /***
     * 查询任务列表
     * @param pageNum 页数
     * @param pageSize 页面大小
     * @return
     */
    @Override
    public DataGridRespVo getJobList(int pageNum, int pageSize) {
        List<JobVo> jobList = jobMapper.selectJobList();
        DataGridRespVo dataGridRespVo = new DataGridRespVo();
        PageHelper.startPage(pageNum,pageSize);
        PageInfo<JobVo> pageInfo = new PageInfo<>(jobList);
        dataGridRespVo.setRows(jobList);
        dataGridRespVo.setTotal(pageInfo.getTotal());
        return dataGridRespVo;
    }
}
